package com.ubing.gxspringboot.gxproxy;

import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class CGLibJoinPoint implements JoinPoint{

    private final Object target;
    private final Method method;
    private final Object[] args;
    private MethodProxy proxy;

    public CGLibJoinPoint(Object target, Method method, Object[] args,MethodProxy proxy) {
        this.target = target;
        this.method = method;
        this.args = args;
        this.proxy=proxy;
    }
    @Override
    public Object process() {
        try {
            return proxy.invokeSuper(target, args);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
}
